package pack;


public class Rayon {

	String nom;
	int tempsDePreparation;
	int max;
	int curr;
	
	
	
	public Rayon(String nom) {
		super();
		this.nom = nom;
	}


	public Rayon(String nom, int temps, int max, int curr) {
		this.nom=nom;
		this.tempsDePreparation=temps;
		this.max=max;
		this.curr=curr;
	}


	public void prend(){
		while(curr == 0){
			try {
				wait();
			} catch (Exception e) {
				// TODO: handle exception
			}
		}
		curr--;		
		notifyAll();
	}



	public void met(){
		while(curr == max){
			try {
				wait();
			} catch (Exception e) {
				// TODO: handle exception
			}
		}
		curr++;
		notifyAll();

	}


	int getTempsDePreparation()	{
		return tempsDePreparation*1000;
	}


	String getNom(){
		return nom;
	}

}